import http from "@/utils/http";

// 订单详情
export const getOrderInfo = () => {
  return http.request({ url: `/order/trade`, method: "GET" });
};

// 订单地址
export const getOrderAddress = () => {
  return http.request({ url: `/userAddress/getOrderAddress`, method: "GET" });
};

//   立即购买
export const getOrderBuy = ({ goodsId, ...data }) => {
  return http.request({
    url: `/order/buy/${goodsId}`,
    method: "GET",
    data: data,
  });
};

//   提交订单
export const submitOrder = (data) => {
  return http.request({ url: `/order/submitOrder`, method: "POST", data: data });
};

// 微信预支付信息
export const createJsapi = ({ orderNo }) => {
  return http.request({
    url: `/webChat/createJsapi/${orderNo}`,
    method: "GET",
  });
};

//   微信支付状态查询
export const queryPayStatus = ({orderNo}) => {
  return http.request({
    url: `/webChat/queryPayStatus/${orderNo}`,
    method: "GET",
  });
};
